package com.smm.imgServer.controller;

import com.smm.imgServer.bo.ImageInfoBo;
import com.smm.imgServer.dao.ImageInfoDao;
import com.smm.imgServer.dao.MongodbDao;
import com.smm.imgServer.domain.Areas;
import com.smm.imgServer.domain.ImageInfo;
import com.smm.imgServer.util.FileUtil;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by tangshulei on 2016/1/29.
 */
@Controller
@RequestMapping("/mongo")
public class MongoController {

    Logger log = Logger.getLogger(this.getClass());

    @Resource
    private ImageInfoBo imageInfoBo;

    @RequestMapping(value="/upload",method = RequestMethod.POST)
    @ResponseBody
    public String uploadImage(@RequestParam(value = "file", required = true) MultipartFile file,String clientId, HttpServletRequest request){
        log.info("upload start");
        String result = imageInfoBo.upload(file,clientId);
        return result;
    }
}
